package com.laihui.view;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import com.laihui.activity.R;

/**
 * Created by chensk on 2017/12/11.
 */

public class PicLinerlayout extends LinearLayout{
    Paint paint;
    Path path;
    public PicLinerlayout(Context context) {


        super(context);
        paint = new Paint();
    }

    public PicLinerlayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        paint = new Paint();


    }


    public PicLinerlayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        paint = new Paint();

    }
    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        // if (remain == 0) {
        // remain = (int) (w - gap) % (2 * radius + gap);
        // }
        // circleNum = (int) ((w - gap) / (2 * radius + gap));
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {

        Bitmap bitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.xszx);
        //	path.moveTo(10, 20);

        canvas.drawBitmap(bitmap,0,0,paint);

        super.dispatchDraw(canvas);

    }

}
